//    Copyright (C) Kherty.  All rights reserved.
using System.Windows;
using System.Windows.Input;

namespace OpenLS.Chart.UI
{
    partial class Panel3DResources
    {
        public Panel3DResources()
        {
                InitializeComponent();
        }
        static readonly Panel3DResources singleton = new Panel3DResources();
        public static Style Panel3DStyle { get { return (Style) singleton["3dPanel"]; } }

        private void Panel_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ((IInputElement) sender).Focus();
            e.Handled = true;
        }

        private void Panel_Loaded(object sender, RoutedEventArgs e)
        {
            var p = (FrameworkElement) sender;
            p.CommandBindings.Add(new CommandBinding(ChartCommands.FormatDataSeries, OnFormatDataSeries));
            p.CommandBindings.Add(new CommandBinding(ChartCommands.Format3DRotation, OnFormat3DRotation));
        }

        private  void OnFormat3DRotation(object sender, ExecutedRoutedEventArgs args)
        {
            var e = (FrameworkElement)sender;
            PropertyHelper.ShowPropertiesFor(ChartElement.GetChartArea(e), e, ChartCommands.FormatChartArea.Text, PropertyTabHint.View3D);
        }
        private  void OnFormatDataSeries(object sender, RoutedEventArgs args)
        {
            var e = (FrameworkElement)args.Source;
            object s = ChartElement.GetSelectedObject(e); 
            PropertyHelper.ShowPropertiesFor(s, e, ChartCommands.FormatDataSeries.Text,PropertyTabHint.None);

           args.Handled = true;

        }

    }
}
